package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.CancleBean;
import com.lwj.liwanjia.impl.CancleView;
import com.lwj.liwanjia.model.CancleTkModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/22.
 */

public class CancleTkPresenter {
    private CancleTkModel cancleTkModel;
    private CancleView cancleView;

    public CancleTkPresenter(CancleView cancleView) {
        this.cancleView = cancleView;
        cancleTkModel = new CancleTkModel();
    }

    public void cacleTk(String token, String tradeId) {
        if (cancleView != null) {
            cancleTkModel.cancleTk(token, tradeId, new Subscriber<CancleBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    cancleView.showError((Exception) e);
                }

                @Override
                public void onNext(CancleBean cancleBean) {
                    cancleView.cancleTk(cancleBean);
                }
            });
        }
    }
}
